package com.slofzx.nuoda.evaluation.param.enums;

import com.slofzx.nuoda.common.EnumConfig;
import com.slofzx.nuoda.common.config.Type;

/**
 * 基准收益率
 */
@EnumConfig(
    id = "base-irr",
    name = "基准收益率"
)
public enum BaseIrrEnum implements Type {
    CONVENTIONAL_OIL_AND_GAS("conventional_oil_and_gas", "常规油气", 1.0),
    SPECIAL_OIL_AND_GAS("special_oil_and_gas", "特殊油气", 2.0),
    COALBED_GAS("coalbed_gas", "煤层气",3.0),
    SHALE_GAS("shale_gas", "页岩气",4.0),
    TIGHT_GAS("tight_gas", "致密气",5.0),
    TIGHT_OIL("tight_oil", "致密油",6.0),
    SHALE_OIL("shale_oil", "页岩油",7.0),
    OIL_SHALE_AND_OIL_SAND_MINES("oil_shale_and_oil_sand_mines", "油页岩及油砂矿",8.0),

    ;


    private String id;
    private String name;
    private double sort;

    private BaseIrrEnum(String id, String name, double sort) {
        this.id = id;
        this.name = name;
        this.sort = sort;
    }

    public String getId() {
        return this.id;
    }

    public String getName() {
        return this.name;
    }

    public double getSort() {
        return this.sort;
    }

    /**
     * 根据id获取枚举值
     * @param id
     * @return
     */
    public static BaseIrrEnum getEnum(String id) {
        if(id == null) {
            return null;
        }
        for(BaseIrrEnum item: BaseIrrEnum.values()) {
            if(id.equals(item.getId())) {
                return item;
            }
        }

        return null;
    }
}
